package org.x.casemodule.enums;

public enum PreviewType {
    //"IMAGE","PDF","DOC","AUDIO","VIDEO","OTHER"
    IMAGE("IMAGE","图片"),
    PDF("PDF","PDF"),
    DOC("DOC","文档"),
    AUDIO("AUDIO","音频"),
    VIDEO("VIDEO","视频"),
    OTHER("OTHER","其他");

    private final String value;
    private final String description;

    PreviewType(String value, String description) {
        this.value = value;
        this.description = description;
    }

    public String getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static PreviewType getByValue(String value) {
        for (PreviewType type : PreviewType.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }

    public static PreviewType getByDescription(String description) {
        for (PreviewType type : PreviewType.values()) {
            if (type.getDescription().equals(description)) {
                return type;
            }
        }
        return null;
    }
}
